package FirstSemester10;

import java.util.ArrayList;

public class StudentText {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student student = new Student();
        list.add(student);
        student.setId(1);
        student.setName("廖义林");

        Student student1 = new Student();
        list.add(student1);
        student1.setId(2);
        student1.setName("张三");
        System.out.println(list);

        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getName().equals(student1.getName())) {
                Student remove = list.remove(i);

            }

        }
        System.out.println(list);
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getName().equals(student.getName())) {
                student.setName("廖义林sb");
            }
        }
        System.out.println(list);
    }
}
